package code;

public class GoalCell extends ContainerCell
{
	private boolean visible;
	private Player player;
	
	public GoalCell(String texture, Player player)
	{
		super(texture);
		visible = false;
		
		this.player = player;
	}
	
	public void setVisible(boolean visible)
	{
		this.visible = visible;
		
		//sacar despues:
		if (visible)
			super.SETTEXTURE("X");
		else
			super.SETTEXTURE("_");
	}
	
	public boolean isVisible()
	{
		return visible;
	}
	
	@Override
	public void placeObject(MovableObject obj)
	{
		super.placeObject(obj);
		
		if (obj.activatesGoal() && visible)
			player.win();
	}
}
